<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controller;
use App\Repository\AdminRepository;

class AdminController extends Controller
{
    public $result;

    public function __construct()
    {
        $this->admin = new AdminRepository();
    }

    public function store($request, $response, $args)
    {
        try {
            $result = $this->admin->addAdmin();
        } catch(\Exception $e) {
            return $e->getMessage();
        }

        if(is_array($result)) {
            return $response->withJson($result);
        }

        return $response->withJson(['username' => $result->username]);
    }

    public function show()
    {
        $admin_id = $this->container->jwt->sub->id;

        var_dump($admin_id);exit;
    }

}
